package com.itheima.demo05stream;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.stream.Stream;

public class Demo02GetStream {
    public static void main(String[] args) {
        //方式1:根据Collection获取流
        //Collection接口中有一个默认的方法:default Stream<E> stream()
        ArrayList<String> list = new ArrayList<>();
        Stream<String> stream1 = list.stream();

        HashSet<String> set = new HashSet<>();
        Stream<String> stream2 = set.stream();

        HashMap<String, String> map = new HashMap<>();
        Stream<String> stream3 = map.keySet().stream();
        Stream<String> stream4 = map.values().stream();

        Stream<Map.Entry<String, String>> stream5 = map.entrySet().stream();

        //方式2: Stream中的静态方法of获取流
        //static<T> Stream<T> of(T... values)

        Stream<String> strs = Stream.of("aa", "bb", "cc");
        Stream<Stream<String>> stream7 = Stream.of(strs);



    }
}
